package cate.common.table.d;

import cate.common.table.common.ParamSheet;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

import java.util.ArrayList;
import java.util.List;

@NoteClass(value = "英雄天赋")
public class GDHeroTalent {
    @NoteField(value = "开启第1个天赋需要的星级", detail = "pos = 0")
    private static int OPEN_1_STAR;

    @NoteField(value = "开启第2个天赋需要的星级", detail = "pos = 1")
    private static int OPEN_2_STAR;

    @NoteField(value = "开启第3个天赋需要的星级", detail = "pos = 2")
    private static int OPEN_3_STAR;

    public static List<Integer> getPosByStar(int star) {
        List<Integer> result = new ArrayList<>();
        if (star >= OPEN_1_STAR) {
            result.add(POS.POS_1);
        }
        if (star >= OPEN_2_STAR) {
            result.add(POS.POS_2);
        }
        if (star >= OPEN_3_STAR) {
            result.add(POS.POS_3);
        }
        return result;
    }

    @NoteClass("天赋-栏位")
    public static class POS {
        @NoteField("栏位1")
        public static final int POS_1 = 0;

        @NoteField("栏位2")
        public static final int POS_2 = 1;

        @NoteField("栏位3")
        public static final int POS_3 = 2;

        public static boolean checkPos(int pos) {
            return pos == POS_1 || pos == POS_2 || pos == POS_3;
        }
    }

    public static int getStarRequiredByPos(int pos) {
        switch (pos) {
            case POS.POS_1:
                return OPEN_1_STAR;
            case POS.POS_2:
                return OPEN_2_STAR;
            case POS.POS_3:
                return OPEN_3_STAR;
        }
        return 999;
    }

    /** 读取excel中配置的参数 */
    public static void initialize(ParamSheet paramSheet) {
        OPEN_1_STAR = GDParamTool.getInt(paramSheet,1150, 6);
        OPEN_2_STAR = GDParamTool.getInt(paramSheet,1151, 11);
        OPEN_3_STAR = GDParamTool.getInt(paramSheet,1152, 13);
    }
}

